<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>居中显示内容</title>

    <style>
        #content {
            width: 800px;
            height: 200px;
            margin: 0 auto;
            border: 1px solid red;
        }

        #canvas {
            display: block;
            width: 800px;
            height: 200px;
            margin: 0 auto;
            
            border: 1px solid green;
        }
    </style>
</head>
<body>
<div id="content">
    <h1>我是内容啊啊啊啊啊啊啊啊啊啊啊啊啊啊</h1>
</div>

<canvas id="canvas"></canvas>
</body>
</html>